package team.epos.merchant.service;

import team.epos.merchant.dao.UserDao;
import team.epos.utils.pojo.MUser;

import java.util.List;
import java.util.TreeMap;

/**
 * @author CHENKI
 */
public class LoginServiceImpl implements LoginService {

    private UserDao userDao = new UserDao();

    @Override
    public MUser findMuser(MUser user) {
        TreeMap<String, Object> param = new TreeMap<>();
        param.put("mname", user.getmName());
        param.put("mpassword", user.getmPassword());
        List list = userDao.getByCondition(MUser.class, param);
        if (list.size() == 0) {
            return null;
        } else  {
            return (MUser) list.get(0);
        }
    }
}
